// 中文官网：https://unocss.nodejs.cn/
import {
    defineConfig,
    presetAttributify,
    presetIcons,
    presetTypography,
    presetUno,
    presetWebFonts,
    transformerDirectives,
    transformerVariantGroup
} from 'unocss'

export default defineConfig({
    shortcuts: [
        // ...
    ],
    theme: {
        colors: {
            // ...
        }
    },
    presets: [
        presetUno(),
        presetAttributify(),
        presetIcons(),
        presetTypography(),
        presetWebFonts({
            fonts: {
                // ...
            },
        }),
    ],
    transformers: [
        transformerDirectives(),
        transformerVariantGroup(),
    ],
    rules: [
        // margin
        [/^m-([\.\d]+)$/, ([_, num]) => ({ margin: `${num}px` })],
        [/^mt-([\.\d]+)$/, ([_, num]) => ({ 'margin-top': `${num}px` })],
        [/^mr-([\.\d]+)$/, ([_, num]) => ({ 'margin-right': `${num}px` })],
        [/^mb-([\.\d]+)$/, ([_, num]) => ({ 'margin-bottom': `${num}px` })],
        [/^ml-([\.\d]+)$/, ([_, num]) => ({ 'margin-left': `${num}px` })],
        [/^mx-([\.\d]+)$/, ([_, num]) => ({ 'margin-left': `${num}px`, 'margin-right': `${num}px` })],
        [/^my-([\.\d]+)$/, ([_, num]) => ({ 'margin-top': `${num}px`, 'margin-bottom': `${num}px` })],
        [/^mc-([\.\d]+)$/, ([_, num]) => ({ margin: `${num}px` `auto`})],
        // padding
        [/^p-([\.\d]+)$/, ([_, num]) => ({ padding: `${num}px` })],
        [/^pt-([\.\d]+)$/, ([_, num]) => ({ 'padding-top': `${num}px` })],
        [/^pr-([\.\d]+)$/, ([_, num]) => ({ 'padding-right': `${num}px` })],
        [/^pb-([\.\d]+)$/, ([_, num]) => ({ 'padding-bottom': `${num}px` })],
        [/^pl-([\.\d]+)$/, ([_, num]) => ({ 'padding-left': `${num}px` })],
        [/^px-([\.\d]+)$/, ([_, num]) => ({ 'padding-left': `${num}px`, 'padding-right': `${num}px` })],
        [/^py-([\.\d]+)$/, ([_, num]) => ({ 'padding-top': `${num}px`, 'padding-bottom': `${num}px` })],
    ]
})